﻿using UnityEngine;
using System.Collections.Generic;

namespace AutoRoot
{
   public static class Global
   {
      public static int maxBranchCount = 4;
      public static Layer layerPlayer = new Layer("Player");
      public static Layer layerDropdownMenu = new Layer("DropdownMenu");
      public static AudioSource currentAudio = null;
      public static MyStory myStory = new MyStory();
      public static LinkedListNode<Section> currentSection;
      public static StoryInfo storyInfo = new StoryInfo();

      public static void LoadAudio(string path)
      {
         MonoBehaviour.print("loading file:///" + path);

         WWW resource = new WWW("file:///" + path);

         while (!resource.isDone)
         {
            MonoBehaviour.print("downloaded " + (resource.progress * 100).ToString("F0") + "%");
         }
         MonoBehaviour.print("downloaded finished");

         MonoBehaviour.print("length " + resource.audioClip.length);
         Global.currentAudio.clip = resource.audioClip;
      }
   }
}